@namespace Microsoft.FluentUI.AspNetCore.Components
@inherits ListComponentBase<TOption>
@typeparam TOption
<CascadingValue Value="_internalListContext" Name="ListContext" TValue="InternalListContext<TOption>" IsFixed="true">
    @InlineStyleValue
    <FluentInputLabel ForId="@Id" Label="@Label" AriaLabel="@AriaLabel" ChildContent="@LabelTemplate" />
    <fluent-select @ref=Element
                   id=@Id
                   class="@ClassValue"
                   style="@StyleValue"
                   open="@Open"
                   position="@Position.ToAttributeValue()"
                   multiple="@Multiple"
                   disabled="@Disabled"
                   appearance="@Appearance.ToAttributeValue()"
                   current-value="@Value"
                   @onchange="@OnChangedHandlerAsync"
                   @attributes="AdditionalAttributes">
        @if (OptionTemplate == null || Items == null)
        {
            @GetListOptions(Items)
        }
        else
        {
            foreach (TOption item in Items)
            {
                <FluentOption TOption="TOption"
                                Value="@GetOptionValue(item)"
                                Selected="@GetOptionSelected(item)"
                                Disabled="@(GetOptionDisabled(item) ?? false)"
                                OnSelect="@OnSelectCallback(item)">
                    @OptionTemplate(item)
                </FluentOption>
            }
        }
    </fluent-select>
</CascadingValue>